package com.srd.phone.bean;

import com.srd.phone.utils.CommonUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class Trecords {

    public int id;
    public String nm;
    public int stat;
    public int uid;
    public double moneys;
    public String stime;
    public int style;
    public int numbers;
    public String numbersm;
    public String statm;
    public static List<Trecords> parseData(String json){
        List<Trecords> list = new ArrayList<Trecords>();
        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                Trecords item = new Trecords();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.id = jsonObject.optInt("id");
                item.nm = jsonObject.optString("nm");
                item.numbers = jsonObject.optInt("numbers");
                item.moneys = jsonObject.optDouble("moneys",0);
                item.stime = CommonUtils.formatDataStr(jsonObject.optString("stime"));
                item.stat = jsonObject.optInt("stat");
                item.numbersm = jsonObject.optString("numbersm");
                item.statm = jsonObject.optString("statm");
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }

}
